<script type="text/javascript">
	var root = "__ROOT__", index = "__Index__";
</script>
<link rel="stylesheet"
	href="__ROOT__/Public/Plugins/uploadify/uploadify.css" />
<script type="text/javascript"
	src="__ROOT__/Public/Plugins/uploadify/jquery.uploadify-3.1.min.js"></script>
<script type="text/javascript"
	src="__ROOT__/Public/Plugins/uploadify/jquery.jUpload.js"></script>
<script type="text/javascript">
	$(function() {
		$('#show_msg').hide();
		$("#upload1")
				.jUpload(
						{
							trigger_id : "t_upload1",
							uploader : "{:U('uploadify/head_img')}",
							queueID : "upload1-queue",
							formData : {
								"<?php echo session_name(); ?>" : "<?php echo session_id(); ?>",
								"savePath" : "/Upload/images/names/",
								"saveRule" : "time",
								"divId" : "img1",
								"thumb" : 1,
							},
							success : function(data, info) {
								var img = $("#img1 img");
								if (img.length == 0) {
									img = $("<img src=\"" + root + data[0]["path"] + "\" alt=\"" + info + "\" style=\"max-height:200px;max-width:300px;\" />")
									$("#img1").append(img);
								} else {
									img.attr("src", root + data[0]["path"]);
								}
								$("input[name=imgid]").val(data[0]['id']);
								$("input[name=imgurl]").val(data[0]['path']);
								$("input[name=imgwidth]").val(data[0]['width']);
								$("input[name=imgheight]").val(
										data[0]['height']);
							}
						});
	})
	function formcheck() {
		if ($("#id").val() == "") {
			if ($("#photo_1").val() == "") {
				$('#show_msg').show();
				return false;
			}
		}
		return true;
	}
</script>
<div id="nav" class="mainnav_title">
	<ul>
		<a href="{:U('lists')}">线路地区</a> |
		<a class="on" href="{:U('edit',array('id'=>$lists['id']))}">编辑线路地区</a>
	</ul>
</div>
<form name="myform" method="post" id="myform"
	action="{:U('linearea/edit')}" onSubmit="return formcheck();">
	<table border="0" cellspacing="0" cellpadding="0" class="table_form"
		width="100%" style="margin: 10px 0px 0px 10ox;">
		<tr>
			<th width="10%"><span class="red">*</span>地区名称:</th>
			<td width="90%"><input type="text" name="name" id="name"
				value="{$lists.name}" class="input-text" /></td>
		</tr>
		<tr>
			<th width="10%"><span class="red">*</span>地区编码:</th>
			<td width="90%"><input type="text" name="code" id="code"
				value="{$lists.code}" class="input-text" /></td>
		</tr>
		<tr>
			<th width="10%"><span class="red">*</span>别名:</th>
			<td width="90%"><input type="text" name="asname" id="asname" value="{$lists.asname}"
				class="input-text" /></td>
		</tr>
		<tr>
			<th><span class="red">*</span>图片</th>
			<td><div id="img1">
					<img src="{$img.path}" alt="上传成功"
						style="max-height: 200px; max-width: 300px">
				</div>
				<div id="upload1-queue"></div> <input class="isFile" type="hidden"
				id="photo_1" name="pic_front" /> <input data-msg-isFile="请先上传图片"
				class="isFile" id="upload1" name="file_upload1" type="file" /> <a
				class="upload_bt" href="javascript:void(0);" id="t_upload1"
				onclick="$('#show_msg').hide();">点击上传</a><span
				class="Validform_checktip f_left Validform_wrong" id="show_msg">请先上传图片再提交</span>
			</td>
		</tr>

		<input type="hidden" class="text" name="id" id="id"
			value="{$lists.id}" />
		<input type="hidden" class="text" name="imgurl" id="imgurl"
			value="{$lists.imgurl}" />
		<input type="hidden" class="text" name="imgid" id="imgid"
			value="{$lists.imgid}" />
		<input type="hidden" class="text" name="imgwidth" id="imgwidth"
			value="{$lists.imgwidth}" />
		<input type="hidden" class="text" name="imgheight" id="imgheight"
			value="{$lists.imgheight}" />

		<tr>
			<td height="100">&nbsp;</td>
			<td>&nbsp;</td>
		</tr>
	</table>
	<div id="btnbox" class="btn">
		<input type="submit" name="submit" value=" 保 存 " class="button">
		<input type="reset" name="reset" value=" 重 置 " class="button">
	</div>
</form>